# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Kevin Piche <kevin@archlinux.org>
# Contributor: Eddie Lozon <almostlucky@attbi.com>

pkgname=pekwm
pkgver=0.3.0
pkgrel=1
pkgdesc='Tabbed X11 window manager'
arch=(loong64 x86_64)
license=(GPL)
url='https://github.com/pekdon/pekwm'
makedepends=(cmake gendesk git ninja)
depends=(libjpeg libpng libxft libxinerama libxpm libxrandr)
optdepends=('lxappearance: feature-rich GTK+ theme switcher'
            'nitrogen: background browser and setter'
            'tint2: basic, good-looking task manager')
backup=(etc/pekwm/autoproperties
        etc/pekwm/autoproperties_typerules
        etc/pekwm/config
        etc/pekwm/config_system
        etc/pekwm/keys
        etc/pekwm/menu
        etc/pekwm/mouse
        etc/pekwm/mouse_click
        etc/pekwm/mouse_sloppy
        etc/pekwm/mouse_system
        etc/pekwm/start
        etc/pekwm/vars)
source=("git+$url#commit=8416ca1d0d136397b53966e84bd47381f439d3c6") # tag: release-0.3.0
b2sums=('SKIP')

prepare() {
  gendesk -f -n --pkgname $pkgname --pkgdesc "$pkgdesc" --name PekWM
  gendesk -f -n -wm --pkgname ${pkgname}_kdm --exec $pkgname --name PekWM
}

build() {
  cmake \
    -B build \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D CMAKE_INSTALL_LIBDIR=lib \
    -G Ninja \
    -S $pkgname
  ninja -C build
}

package() {
  DESTDIR="$pkgdir" ninja -C build install
  install -Dm644 $pkgname.desktop \
    "$pkgdir"/usr/share/xsessions/$pkgname.desktop
  install -Dm644 ${pkgname}_kdm.desktop \
    "$pkgdir"/usr/share/apps/kdm/sessions/$pkgname.desktop
}
